import { Controller, Get, Query } from '@nestjs/common';
import { CustomerService } from './customer.service';

@Controller('customers')
export class CustomerController {
  constructor(private readonly customerService: CustomerService) {}

  @Get()
  async queryCustomers(
    @Query('name') name?: string,
    @Query('phone') phone?: string,
    @Query('page') page?: number,
    @Query('size') size?: number,
  ) {
    return this.customerService.queryCustomers({
      name,
      phone,
      page: page ? Number(page) : undefined,
      size: size ? Number(size) : undefined,
    });
  }
}
